package com.hongyue.zuoYE;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

public class Demo {
    public static void main(String[] args) {
        Collection<String> arr = new ArrayList<>();
        arr.add("JavaEE企业级开发指南");
        arr.add("Oracle高级编程");
        arr.add("MySQL从入门到精通");
        arr.add("Java架构师之路");
        Iterator<String> it = arr.iterator();
        while (it.hasNext()) {
            System.out.println(it.next());
        }
        Iterator<String> it1 = arr.iterator();
        while (it1.hasNext()) {
            String next = it1.next();
            if (next.length() <= 10) {
                System.out.println(next);
            }
        }
        System.out.println("------");
        Iterator<String> it2 = arr.iterator();
        while (it2.hasNext()) {
            String next = it2.next();
            if (next.contains("Java")) {
                System.out.println("next = " + next);
            }
        }

    }

    private static ArrayList<Integer> a(ArrayList<Integer> b) {
        if (b.size() <= 1) {
            return b;
        }
        int c = b.get(0);
        ArrayList<Integer> a1 = new ArrayList<>();
        ArrayList<Integer> a2 = new ArrayList<>();
        for (int i = 1; i < b.size(); i++) {
            if (b.get(i) >= c) {
                a1.add(b.get(i));
            } else if (b.get(i) < c) {
                a2.add(b.get(i));
            }
            //return a(a2) + c + a(a1);
        }
        return b;
    }
}
